UPDATE Voucher SET VoucherNo = 'RV-' + (SELECT CONVERT(varchar, ReceiptVNo, 0) FROM ReceiptInfo WHERE (Type = 'REC FEE') AND Voucher.VoucherID = ReceiptInfo.AccountVoucherID) WHERE (VoucherNo LIKE 'JV-%') AND (ReadOnly = 1) AND (VoucherID IN (SELECT AccountVoucherID FROM ReceiptInfo WHERE (Type = 'REC FEE')))